// 创建store
import { createStore, applyMiddleware, combineReducers } from 'redux'
import { composeWithDevTools } from 'redux-devtools-extension'
import thunk from 'redux-thunk'
import lsReducer from './ls/redux/reducer'
import zsReducer from './zs/redux/reducer'

// 注意: 由于实际开发是协作开发,所以一定会出现多个reducer.但是创建store的时候,只能传入一个reducer. 所以就必须将多个reducer合并成一个
//#region
/*
// 注意: 合并之后的reducer大概是这样
function reducer(state= {zs:{c:0},ls:{list:[]}},action){
  switch(action.type){
    case PUSH:
      ...忽略
      return {}

    case ADD:
      ...忽略
      return {}

    deafult
      return state
  }
}
*/
//#endregion
//
const rootReducer = combineReducers({
  zs: zsReducer,
  ls: lsReducer,
})
// console.log(rootReducer)
export default createStore(
  rootReducer,
  composeWithDevTools(applyMiddleware(thunk))
)
